package com.copy.pojo;

import org.springframework.beans.factory.FactoryBean;
/**
 * author: liziyun
 * date: 2019-9-30
 * email: root@ofo.email
 * describe: 工厂方法模式，Spring专用组件
 *     工厂创建Bean，到Spring的IOC容器。
 */
public class EasyCopyFactoryBean<T> implements FactoryBean<T> {
    public Class<T> interfaceType;
    public T proxyBean;
    public EasyCopyFactoryBean(Class<T> interfaceType, T proxyBean) {

        this.interfaceType = interfaceType;
        this.proxyBean=proxyBean;
    }


    @Override
    public T getObject() throws Exception {
        return proxyBean;
    }

    @Override
    public Class<?> getObjectType() {
        return interfaceType;
    }

    @Override
    public boolean isSingleton() {
        return true;
    }
}
